#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Desc    : 
@File    ：08_generate_qr_code.py
@Author  ：edencpchen
@Date    ：2025/11/8 22:50 
'''

import segno
import os
from pathlib import Path

# 你的视频链接
video_url = "https://edencpchen-1258462934.cos.ap-chengdu.myqcloud.com/bad8c45962cea8132bda8fdb12d6e977.mp4"


def generate_qr_segno(text, filename="qrcode.png", scale=8):
    """使用 segno 库生成二维码"""
    try:
        qr = segno.make(text)
        qr.save(filename, scale=scale)
        print(f" 二维码已生成: {filename}")
        return filename
    except Exception as e:
        print(f" segno 生成失败: {e}")
        return None


# 尝试 segno
result = generate_qr_segno(video_url, "test_segno.png")
if result:
    print('success')
